<?php
declare (strict_types = 1);

namespace app\shop\controller;

use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;
use app\common\service\GoodsService\ProveService;
use app\BaseShopController;
use app\Normal;
use think\Request;

/**
 * @Group("Prove")
 * @Middleware({shopMiddileware::class})
 */
class Prove extends BaseShopController
{
    /**
     * 获取数据表分页
     * @Route("getListByPage",method="GET")
     * @return string
     */
    public function getListByPage() {     
        $result = callApi(ProveService::class, 'getListByPage',$this->_all_data);
        return apiResponse($result);
    }
    /**
     * 获取数据表
     * @Route("getListBySelect",method="GET")
     * @return string
     */
    public function getListBySelect() {     
        $result = callApi(ProveService::class, 'getListBySelect',$this->_all_data);
        return apiResponse($result);
    }
    
    /**
     * 新增数据
     * @Route("addProve",method="POST")
     * @return string
     */
    public function addProve() {     
        $result = callApi(ProveService::class, 'addProve',$this->_all_data);
        if($result['code'] == Normal::SUC){
            $this->log(['content'=>'新增证明','request_param'=> json_encode($this->_all_data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
        }
        return apiResponse($result);
    }
    /**
     * 修改数据
     * @Route("editProve",method="PUT")
     * @return string
     */
    public function editProve() {     
        $result = callApi(ProveService::class, 'editProve',$this->_all_data);
        if($result['code'] == Normal::SUC){
            $this->log(['content'=>'修改证明','request_param'=> json_encode($this->_all_data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
        }
        return apiResponse($result);
    }
    
    /**
     * 删除数据
     * @Route("delProve",method="DELETE")
     * @return string
     */
    public function delProve() {     
        $result = callApi(ProveService::class, 'delProve',$this->_all_data);
        if($result['code'] == Normal::SUC){
            $this->log(['content'=>'删除证明','request_param'=> json_encode($this->_all_data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
        }
        return apiResponse($result);
    }
    /**
     * 设置默认
     * @Route("setDefault",method="PUT")
     * @return string
     */
    public function setDefault() {     
        $result = callApi(ProveService::class, 'setDefault',$this->_all_data);
        if($result['code'] == Normal::SUC){
            $this->log(['content'=>'设置默认','request_param'=> json_encode($this->_all_data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
        }
        return apiResponse($result);
    }
}